import React, { Component } from 'react';
import './style/index.css'

class Navbar extends Component {

    onClick = () => { 
        this.props.onClick && this.props.onClick()
    }
    render() {
        let { title,rightText,showArrow } = this.props; 
        return (
            <div className='navbar'>
                <div onClick={this.onClick} className='navbarArrow'>
                  { !showArrow ? <img alt='' src={require('./img/left.png')}></img> : null}
                </div>
                <div className='navbarTitle'>
                    {title}
                </div>
                <div onClick={()=>{
                    this.props.rightTextClick && this.props.rightTextClick()
                }} className='navbarRightText'>
                  <span>{rightText}</span>   
                </div>
            </div>
        )
    }
}

export default Navbar;